home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
tbones07.zip
/
TSRBONES.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-01-20
|
38KB
|
794 lines
;************************
PAGE 55,132 ;Format .LST listing at 55 lines by 132 columns.
TITLE TSRBONES Version 0.1 Jan 20 91 Robert Curtis Davis
SUBTTL Introduction
;**************************************************************************
;
; TSRBONES.ASM Version 0.1 Jan 20 91
; A part of the TBONES software package.
;
; Copyright (C) 1990, 1991 by Robert Curtis Davis,
; All Rights Reserved.
;
; DESCRIPTION:
; ASM Program template for Terminate-and-Stay-Resident (TSR) programs
; that are activated by a specified HotKey WHEN DOS IS NOT
; BUSY (the InDOS Flag AND the DOS Critical Error Flag are zero)
; flag), OR WHEN DOS IS AT "BUSY IDLE" (when INT28h is called),
; AND WHEN NO HARDWARE INTERRUPT IRQ0-IRQ7 IS BEING HANDLED.
; This avoids problems of interfering with hardware interrupt
; handling and with DOS non-reentrancy; and allows DOS function
; calls above 0Ch to be used in the TSR routine. The TSR's code
; prevents multiple installations. Also checks DOS version and
; requires DOS Version 2 or later before installation is
; permitted.
;
; PURPOSE:
; Provides a skeletal framework program as a starting point in the
; design of your own HotKey TSRs which use DOS function calls, and
; for which a single installation is desired.
;
; E-mail address:
; Internet: sonny@trantor.harris-atd.com
;
; US Mail address:
; 430 Bahama Drive
; Indialantic, FL 32903
;
;**************************************************************************
;
; Special thanks to Roy Silvernail, whose persistent hacking (in the best
; sense of that word) and E-mail exchanges over the holiday season in
; December 1990, rooted out TBONES incompatibilities with Borland's TASM v.1.0.
;
;**************************************************************************
;
; Special thanks to Anto Prijosoesilo and Richard Brittain for E-mail
; exchanges which helped solve detailed problems with the implementation of
; the "Pseudo-Environment" idea.
;
;**************************************************************************
;
; Special thanks to David Kirschbaum, whose Toad Hall Tweaks significantly
; improved an early version of the TBONES Assembly Language code:
;
;v0.01 Toad Hall Tweak, 25 Nov 90
;**************************************************************************
SUBTTL Code Segment
PAGE
;**************************************************************************
;
CodeSeg segment
assume cs:CodeSeg,ds:CodeSeg
BeginDump EQU $ ;Roy Silvernail - Keep TASM 1.0 happy
;when computing # resident paragraphs.
;
org 2CH ;v0.01 ORG in PSP to pick up the
envseg label word ;v0.01 Environment Segment.
;
org 100h ;ORG for all COM programs.
;
Entry PROC NEAR ;v0.01
jmp TSRinit ;Jump over resident portion and
;initialize things and make code
;between Entry: and TSRinit: resident.
;
; Old Interrupt Vectors are stored here during TSR initialization:
oldint09 dd ? ;Keyboard Hardware Interrupt.
oldint13 dd ? ;Disk BIOS Interrupt.
oldint16 dd ? ;Keyboard BIOS Interrupt.
oldint28 dd ? ;DOS Idle Interrupt.
;
; For this HotKey TSR Template, specify Keyboard Interrupt 09h as the Hook:
HOOK09 equ 09h ;Hooked Interrupt 09h.
; Int 13h is used to set a flag to prevent TSR trigger while disk active:
HOOK13 equ 13h ;Hooked Interrupt 13h.
; Int 16h is hooked solely to provide way to check for prior TSR installation.
HOOK16 equ 16h ;Hooked Interrupt 16h.
; We also have to hook Interrupt 28h to check for "DOS idle":
HOOK28 equ 28h ;Hooked Interrupt 28h.
;
bellgate db 0 ;Gate closed (=1) when in Bell routine.
;Gate open (=0) when not in Bell routine.
; Below:
; EQUates related to the Intel 8259A Programmable Interrupt Controller (PIC)
; chip. Hardware Interrupts IRQ0 through IRQ7 are controlled by the PIC.
;
; To really understand the nitty-gritty details of this stuff,
; you have to study the Intel Specification data for the 8259A PIC chip.
; These EQUates are used in this TSR to examine the PIC chip's In Service
; Register (ISR) to be sure that the TSR is not interrupting one of
; the hardware interrupt service routines. The reason for not wanting to
; interrupt these hardware interrupt service routines is that they are
; often time-critical and can be compromised by intruding on them with
; our TSR (for example, a hardware COM port interrupt-driven comm
; program might lose bytes on a modem transfer if we bull our way in and
; steal the CPU away from the comm program's service routine):
PICPORT EQU 20h ;I/O Port for the 8259A PIC chip.
ISRREQ EQU 00001011B ;This is a byte defining the
;Operation Control Word 3 (OCW3) to
;output on port 20h to make the PIC
;chip's In Service Register available
;for reading by the CPU on the
;next IN 20h command.
;
; EQUs defining Key Flag weights in the Key Flag Byte:
RSHIFT equ 00000001B ;Right Shift Key Flag weight.
LSHIFT equ 00000010B ;Left Shift Key Flag weight.
CTRL equ 00000100B ;Ctrl Key Flag weight.
ALT equ 00001000B ;Alt Key Flag weight.
;SCROLL equ 00010000B ;Scroll Lock Key Flag weight.
;NUM equ 00100000B ;Num Lock Key Flag weight.
;CAPS equ 01000000B ;Caps Lock Key Flag weight.
INSRT equ 10000000B ;Ins Key Flag weight.
;
LockKeyMask equ 10001111B ;For masking out Scroll, Caps,
;and Num Lock bits in KeyFlags.
;
; Pointer to "DOS busy" (InDOS) flag (loaded during TSR initialization):
indosptr dd ?
;
; Pointer to "Critical Error" (CritErr) flag (loaded at TSR initialization):
criterrptr dd ?
;
; Pointer to "Print Screen" busy (PrtScrn) flag
prtscrn dd 00500000h
;
; hotkeyflag used to signal HotKey pressed to "DOS idle" Interrupt 28h:
hotkeyflag db 0 ;hotkeyflag initially zero.
;
; diskflag used to prevent TSR trigger during time-critical Disk operations:
diskflag db 0 ;diskflag initially zero.
;*************************************************************************
; Your HotKey is specified here:
; (This sample HotKey is set for Ctrl-Alt-B)
;
; Specify TSR's HotKey Shift Keys:
KEYFLAGBYTE equ CTRL+ALT ;HotKey Flags
;
; Specify TSR's HotKey Scan Code:
HOTKEY equ 30h ;'B' (for Bones) key
;
;*************************************************************************
; Specify TSR's signature words:
TSRsigA equ 'TS' ;'TSRBONES' Signature
TSRsigB equ 'RB'
TSRsigC equ 'ON'
TSRsigD equ 'ES'
;*************************************************************************
Entry ENDP ;v0.01
;
;*************************************************************************
SUBTTL User-supplied TSR Routine
PAGE
;*************************************************************************
ROUTINE PROC NEAR
;*************************************************************************
; Code for your HotKey-triggered TSR routine GOES HERE:
; ( Here, a dummy routine has been placed which simply rings the
; terminal Bell whenever the TSR is triggered. )
;
; Announce this dummy TSR's trigger by a Bell signal:
;
Enter:
mov al,07h ;al = ASCII Bell.
mov bh,0 ;Video page.
mov cx,1 ;No. of bytes to write.
mov ah,0Eh ;BIOS Int10,OEh=TTY Screen.
Int 10h ;Write ASCII Bell to screen.
;
Exit:
ret